//package com.zhl.media.app.utils;
//
//import android.os.Environment;
//
//import com.birbit.android.jobqueue.Job;
//import com.jess.arms.utils.LogUtils;
//import com.zhl.media.app.model.MediaPhoto;
//import com.zhl.media.app.thread.UploadJob;
//import com.zhl.media.commonsdk.data.UserUtil;
//import java.io.File;
//import java.io.IOException;
//import okhttp3.MediaType;
//import okhttp3.MultipartBody;
//import okhttp3.OkHttpClient;
//import okhttp3.Request;
//import okhttp3.RequestBody;
//import okhttp3.Response;
//import okhttp3.ResponseBody;
//public class ClientUploadUtils {
//    public void uploadPhoto(String url, MediaPhoto mediaPhoto, UploadJob job) throws Exception {
//        OkHttpClient client = new OkHttpClient();
////        File file = new File(mediaPhoto.getPhotoPath());
//        System.out.println(Environment.getExternalStorageDirectory().toString());
//        File file = new File(Environment.getExternalStorageDirectory().toString() + "/app-release.apk");
//        RequestBody requestBody = new MultipartBody.Builder().setType(MultipartBody.FORM)
//                .addFormDataPart("file", file.getName(), RequestBody.create(MediaType.parse("multipart/form-data"), file))
//                .addFormDataPart("mediaId",mediaPhoto.getMediaId())
//                .build();
//        String token = UserUtil.getTokenInfo().getAccess_token();
//        Request request = new Request.Builder()
//                .header("Authorization", "Bearer" + token)
//                .url(url)
//                .post(requestBody)
//                .build();
//        LogUtils.warnInfo("upload", "上传成功");
//        Response response = client.newCall(request).execute();
//        if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
//    }
//}
//
